package entity

import (
	"time"

	"github.com/google/uuid"
	"techoiceness.com/aiagent/llm-gateway/internal/auth"
)

// User 用户模型
type User struct {
	ID           uuid.UUID `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()"`
	Username     string    `gorm:"unique;not null;size:255"`
	PasswordHash string    `gorm:"not null;size:255"`
	CreatedAt    time.Time `gorm:"autoCreateTime"`
	UpdatedAt    time.Time `gorm:"autoUpdateTime"`
}

// TableName specifies the table name for the User model.
func (User) TableName() string {
	return "users"
}

// 实现 auth.Authenticatable 接口
func (u *User) GetID() uuid.UUID {
	return u.ID
}

func (u *User) GetUsername() string {
	return u.Username
}

var _ auth.Authenticatable = (*User)(nil)
